home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2.sit
/
Raven 1.2
/
Source
/
Foundation
/
Common
/
ZProfiler.h
< prev
next >
Wrap
Text File
|
1997-09-06
|
2KB
|
114 lines
/*
* File: ZProfiler.h
* Summary: Stack based class used to profile blocks of code.
* Written by: Jesse Jones
*
* Copyright ゥ 1996-1997 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <3> 9/05/97 JDJ Added IsEnabled.
* <2> 7/27/97 JDJ Added Enable and Disable methods.
* <1> 12/05/96 JDJ Created
*/
#pragma once
#include <string>
#if __profile__
#include <Profiler.h>
#endif
//================================================================================
// class TProfiler
//================================================================================
class TProfiler {
//-----------------------------------
// Initialization/Destruction
//
public:
~TProfiler();
TProfiler(const string& fileName, short numFunctions = 2000, short stackDepth = 75);
// Destructor will ASSERT if numFunctions or stackDepth isn't large enough.
//-----------------------------------
// API
//
public:
bool IsEnabled() const;
void Enable();
// Turns profiling on.
void Disable();
// Turns profiling off.
protected:
#if __profile__
string mFileName;
int mNumFunctions;
int mStackSize;
long mEnableCount;
static bool msConstructed;
#endif
};
//================================================================================
// class TProfileEnabler
//================================================================================
class TProfileEnabler {
public:
~TProfileEnabler();
TProfileEnabler();
protected:
#if __profile__
bool mWasEnabled;
#endif
};
//================================================================================
// Inlines
//================================================================================
#if !__profile__
inline TProfiler::~TProfiler()
{
}
inline TProfiler::TProfiler(const string&, short, short)
{
}
inline bool TProfiler::IsEnabled() const
{
return false;
}
inline void TProfiler::Enable()
{
}
inline void TProfiler::Disable()
{
}
inline TProfileEnabler::~TProfileEnabler()
{
}
inline TProfileEnabler::TProfileEnabler()
{
}
#endif // !__profile__